# !/usr/bin/env python
# _*_ coding:utf-8 _*_
from django.conf import settings
from django.core.files.storage import Storage


class FastDFSStorage(Storage):
    def __init__(self, base_url=None):
        self.base_url = base_url or settings.FDFS_BASE_URL

    # 必须实现的函数
    def _open(self, name, mode='rb'):
        pass

    def _save(self, name, content, max_length=None):
        pass

    # 重写url
    def url(self, name):

        # http://192.168.90.172:8888/group1/M00/00/00/CtM3BVnihx-AKdf0AAPWWMjR7sE771.jpg
        # base_url + name

        return self.base_url + name
